package br.com.infnet.posgraduacao.bean;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import br.com.infnet.cultbook.repository.dao.impl.LoginService;

@ManagedBean(name = "clienteLoginBean")
@SessionScoped
public class ClienteLoginBean {
	
	private final String LOGIN = "login";
	private final String CARRINHO = "carrinho";
	
	@EJB
	private LoginService loginService;
	
	private String login;
	private String senha;
	
	public String logar() {
		loginService.logar(login, senha);
		
		if(loginService.verificaLogin()) {
			return CARRINHO;
		} else {
			return LOGIN;		
		}
	}
		
	public void deslogar() {		
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public LoginService getLoginService() {
		return loginService;
	}
}
